package cn.trasen.his.poc.std.api.model.inpatient;

import cn.trasen.his.poc.std.api.emums.DrugTypeEnum;
import cn.trasen.his.poc.std.api.emums.ManagerTypeEnum;
import cn.trasen.his.poc.std.api.emums.OrderStatusEnum;
import cn.trasen.his.poc.std.api.emums.OrderTypeEnum;
import cn.trasen.his.poc.std.api.model.drug.DrugDictionary;
import cn.trasen.his.poc.std.api.model.drug.DrugFrequency;
import cn.trasen.his.poc.std.api.model.drug.DrugUnit;
import cn.trasen.his.poc.std.api.model.drug.DrugUsage;
import cn.trasen.his.poc.std.api.model.major.DeptInfo;
import pro.shushi.pamirs.boot.base.ux.annotation.field.UxWidget;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxDetail;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxForm;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @Description: 住院医嘱详情表实体
 * @author: Jacob
 * @Date: 2024-11-26 13:47:02
 * @Company: 湖南创星科技股份有限公司
 */
@UxForm(grid = 3)
@UxDetail(grid = 3)
@Model.model(OrderRecord.MODEL_MODEL)
@Model(displayName = "医嘱项目", labelFields = "orderName")
@Model.Advanced(ordering = "sortNo ASC")
public class OrderRecord extends IdModel {

    public static final String MODEL_MODEL = "ts.his.OrderRecord";

    @Field.String
    @Field(displayName = "医嘱名称", required = true)
    private String orderName;

    @Field.Enum
    @Field(displayName = "医嘱类型", required = true)
    private OrderTypeEnum orderType;

    @Field.many2one
    @Field.Relation(relationFields = {"drugId"}, referenceFields = {"id"})
    @Field(displayName = "医嘱名称/药品名称", required = true)
    private DrugDictionary drug;

    @Field.Integer
    @Field(displayName = "医嘱ID", invisible = true)
    private Long drugId;

    @Field.Enum
    @Field.Related(related = {"drug", "drugType"})
    @UxForm.FieldWidget(@UxWidget(readonly = "true"))
    @Field(displayName = "药品类型")
    private DrugTypeEnum drugType;

    @Field.Integer
    @Field(displayName = "剂量", required = true)
    private Integer dosage;

    @Field.many2one
    @Field.Relation(relationFields = {"dosageUnitId"}, referenceFields = {"id"})
    @Field(displayName = "剂量单位", required = true)
    private DrugUnit dosageUnit;

    @Field.Integer
    @Field(displayName = "剂量单位ID", invisible = true)
    private Long dosageUnitId;

    @Field.many2one
    @Field.Relation(relationFields = {"usageId"}, referenceFields = {"id"})
    @Field(displayName = "药品用法")
    private DrugUsage drugUsage;

    @Field.Integer
    @Field(displayName = "用法ID", invisible = true)
    private Long usageId;

    @Field.many2one
    @Field.Relation(relationFields = {"frequencyId"}, referenceFields = {"id"})
    @Field(displayName = "药品频次")
    private DrugFrequency drugFrequency;

    @Field.Integer
    @Field(displayName = "频次ID", invisible = true)
    private Long frequencyId;

    @Field.Integer
    @Field(displayName = "用药天数", required = true)
    private Integer days;

    @Field.many2one
    @Field.Relation(relationFields = {"deptId"}, referenceFields = {"id"}, domain = "deptType =='KE_SHI'")
    @Field(displayName = "开单科室", required = true)
    private DeptInfo dept;

    @Field.Integer
    @Field(displayName = "开单科室ID", invisible = true)
    private Long deptId;

    @Field.Enum
    @Field(displayName = "管理类型")
    private ManagerTypeEnum mngType;

    @Field.String
    @Field(displayName = "开单医生ID")
    private String orderDocId;

    @Field.String
    @Field(displayName = "开单医生名称")
    private String orderDocName;

    // 开始时间的是啥意思
    @Field.Date
    @Field(displayName = "开始时间")
    private Date orderBdate;

    @Field.Integer
    @Field(displayName = "排序号")
    private Long sortNo;

    @Field.Integer
    @Field(displayName = "滴速")
    private Integer dropSper;

    @Field.many2one
    @Field.Relation(relationFields = {"execDeptId"}, referenceFields = {"id"}, domain = "deptType =='KE_SHI'")
    @Field(displayName = "执行科室", required = true)
    private DeptInfo execDept;

    @Field.String
    @Field(displayName = "执行科室ID", invisible = true)
    private String execDeptId;

    @Field.Enum
    @Field(displayName = "医嘱状态", required = true)
    private OrderStatusEnum statusFlag;

    @Field.Float(D = 2)
    @Field(displayName = "总量", required = true)
    private Double amount;

    @Field.many2one
    @Field.Relation(relationFields = {"amountUnitId"}, referenceFields = {"id"})
    @Field(displayName = "总量单位", required = true)
    private DrugUnit amountUnit;

    @Field.String
    @Field(displayName = "总量单位ID", invisible = true)
    private String amountUnitId;

    @Field.Integer
    @Field(displayName = "总量单位比例")
    private Long amountUnitRatio;

    @Field.Money(D = 2)
    @Field(displayName = "医嘱新价格")
    private BigDecimal orderNewPrice;

    @Field.Integer
    @Field(displayName = "剂数")
    private Long bagNum;

    @Field.Money(D = 2)
    @Field(displayName = "总金额")
    private BigDecimal totalMoney;

    @Field.Text
    @Field(displayName = "嘱托")
    private String exhortation;

    @Field.Integer
    @Field(displayName = "医嘱信息ID", invisible = true)
    private Long medAdviceId;

}